// BrowseDlg.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "testmouse.h"
#include "BrowseDlg.h"
#include "Registery.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBrowseDlg dialog


CBrowseDlg::CBrowseDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CBrowseDlg::IDD, pParent)
{
	CRegistery   RegKey;

	//{{AFX_DATA_INIT(CBrowseDlg)
	m_strRunFileName = _T("");
	//}}AFX_DATA_INIT
    RegKey.GetKey( "SOFTWARE\\Cypress TouchPad Driver", "RunPathExe", m_strRunFileName );
}


void CBrowseDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBrowseDlg)
	DDX_Text(pDX, IDC_RUN_FILENAME, m_strRunFileName);
	DDV_MaxChars(pDX, m_strRunFileName, 80);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBrowseDlg, CDialog)
	//{{AFX_MSG_MAP(CBrowseDlg)
	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBrowseDlg message handlers

void CBrowseDlg::OnBrowse() 
{
	// TODO: Add your control notification handler code here
    char szFilters[]= "Executable File (*.exe)|*.exe|All Files (*.*)|*.*||";
    // Create an Open dialog; the default file name extension is ".my".
    CFileDialog fileDlg (TRUE, "exe", "*.exe", OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);

    // Display the file dialog. When user clicks OK, fileDlg.DoModal() 
    // returns IDOK.
    if ( fileDlg.DoModal ()==IDOK )
    {
       m_strRunFileName = fileDlg.GetPathName();
    }
	UpdateData( FALSE );	
}

